﻿using System.Web.Http;
using System.Web.Http.Validation;
using System.Web.Http.Validation.Providers;
using System.Web.Routing;
using Newtonsoft.Json.Serialization;

namespace Medora.Web.Configs
{
    /// <summary>
    /// Class ApiConfig
    /// </summary>
    public class ApiConfig
    {

        /// <summary>
        /// Registers this instance.
        /// </summary>
        public static void Register()
        {
            var config = GlobalConfiguration.Configuration;

            IocConfig.RegisterIoc(config);

            RouteConfig.RegisterRoutes(RouteTable.Routes);

            config.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
            config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            //config.Services.RemoveAll(typeof(ModelValidatorProvider), (provider) => provider is InvalidModelValidatorProvider);

            FiltersConfig.RegisterFilters(config);
        }
    }
}